diff --git a/system/helpers/date_helper.php b/system/helpers/date_helper.php
index a655c1f..cb15f6d 100644
--- a/system/helpers/date_helper.php
+++ b/system/helpers/date_helper.php
@@ -739,121 +739,89 @@
 
 		$range = array();
 
-		if (is_php('5.2'))
+		/* NOTE: Even though the DateTime object has many useful features, it appears that
+		 *	 it doesn't always handle properly timezones, when timestamps are passed
+		 *	 directly to its constructor. Neither of the following gave proper results:
+		 *
+		 *		new DateTime('<timestamp>')
+		 *		new DateTime('<timestamp>', '<timezone>')
+		 *
+		 *	 --- available in PHP 5.3:
+		 *
+		 *		DateTime::createFromFormat('<format>', '<timestamp>')
+		 *		DateTime::createFromFormat('<format>', '<timestamp>', '<timezone')
+		 *
+		 *	 ... so we'll have to set the timestamp after the object is instantiated.
+		 *	 Furthermore, in PHP 5.3 we can use DateTime::setTimestamp() to do that and
+		 *	 given that we have UNIX timestamps - we should use it.
+		*/
+		$from = new DateTime();
+
+		if (is_php('5.3'))
 		{
-			/* NOTE: Even though the DateTime object has many useful features, it appears that
-			 *	 it doesn't always handle properly timezones, when timestamps are passed
-			 *	 directly to its constructor. Neither of the following gave proper results:
-			 *
-			 *		new DateTime('<timestamp>')
-			 *		new DateTime('<timestamp>', '<timezone>')
-			 *
-			 *	 --- available in PHP 5.3:
-			 *
-			 *		DateTime::createFromFormat('<format>', '<timestamp>')
-			 *		DateTime::createFromFormat('<format>', '<timestamp>', '<timezone')
-			 *
-			 *	 ... so we'll have to set the timestamp after the object is instantiated.
-			 *	 Furthermore, in PHP 5.3 we can use DateTime::setTimestamp() to do that and
-			 *	 given that we have UNIX timestamps - we should use it.
-			*/
-			$from = new DateTime();
-
-			if (is_php('5.3'))
-			{
-				$from->setTimestamp($unix_start);
-				if ($is_unix)
-				{
-					$arg = new DateTime();
-					$arg->setTimestamp($mixed);
-				}
-				else
-				{
-					$arg = (int) $mixed;
-				}
-
-				$period = new DatePeriod($from, new DateInterval('P1D'), $arg);
-				foreach ($period as $date)
-				{
-					$range[] = $date->format($format);
-				}
-
-				/* If a period end date was passed to the DatePeriod constructor, it might not
-				 * be in our results. Not sure if this is a bug or it's just possible because
-				 * the end date might actually be less than 24 hours away from the previously
-				 * generated DateTime object, but either way - we have to append it manually.
-				 */
-				if ( ! is_int($arg) && $range[count($range) - 1] !== $arg->format($format))
-				{
-					$range[] = $arg->format($format);
-				}
-
-				return $range;
-			}
-
-			$from->setDate(date('Y', $unix_start), date('n', $unix_start), date('j', $unix_start));
-			$from->setTime(date('G', $unix_start), date('i', $unix_start), date('s', $unix_start));
+			$from->setTimestamp($unix_start);
 			if ($is_unix)
 			{
 				$arg = new DateTime();
-				$arg->setDate(date('Y', $mixed), date('n', $mixed), date('j', $mixed));
-				$arg->setTime(date('G', $mixed), date('i', $mixed), date('s', $mixed));
+				$arg->setTimestamp($mixed);
 			}
 			else
 			{
 				$arg = (int) $mixed;
 			}
-			$range[] = $from->format($format);
 
-			if (is_int($arg)) // Day intervals
+			$period = new DatePeriod($from, new DateInterval('P1D'), $arg);
+			foreach ($period as $date)
 			{
-				do
-				{
-					$from->modify('+1 day');
-					$range[] = $from->format($format);
-				}
-				while (--$arg > 0);
+				$range[] = $date->format($format);
 			}
-			else // end date UNIX timestamp
-			{
-				for ($from->modify('+1 day'), $end_check = $arg->format('Ymd'); $from->format('Ymd') < $end_check; $from->modify('+1 day'))
-				{
-					$range[] = $from->format($format);
-				}
 
-				// Our loop only appended dates prior to our end date
+			/* If a period end date was passed to the DatePeriod constructor, it might not
+			 * be in our results. Not sure if this is a bug or it's just possible because
+			 * the end date might actually be less than 24 hours away from the previously
+			 * generated DateTime object, but either way - we have to append it manually.
+			 */
+			if ( ! is_int($arg) && $range[count($range) - 1] !== $arg->format($format))
+			{
 				$range[] = $arg->format($format);
 			}
 
 			return $range;
 		}
 
-		/* ----------------------------------------------------------------------------------
-		 * PHP Version is < 5.2. We have no other option, but to calculate manually ...
-		 *
-		 * NOTE: If we do something like this:
-		 *
-		 *		$unix_timestamp + 86400
-		 *
-		 *	 ... due to DST, there's a possibility of calculation errors and/or incorrect
-		 *	 hours generated (if the specified format displays such data).
-		 */
-
-		$from = $to = array();
-		sscanf(date('Y-n-j G:i:s', $unix_start), '%d-%d-%d %d:%d:%d', $from['y'], $from['mo'], $from['d'], $from['h'], $from['mi'], $from['s']);
-
-		// If we don't have the end timestamp, let mktime() calculate it
-		$unix_end = ($is_unix) ? (int) $mixed : mktime($from['h'], $from['mi'], $from['s'], $from['mo'], $from['d'] + $mixed, $from['y']);
-
-		$end_check = date('Ymd', $unix_end);
-		while (date('Ymd', $unix_start = mktime($from['h'], $from['mi'], $from['s'], $from['mo'], $from['d'], $from['y'])) !== $end_check)
+		$from->setDate(date('Y', $unix_start), date('n', $unix_start), date('j', $unix_start));
+		$from->setTime(date('G', $unix_start), date('i', $unix_start), date('s', $unix_start));
+		if ($is_unix)
 		{
-			$range[] = date($format, $unix_start);
-			$from['d']++;
+			$arg = new DateTime();
+			$arg->setDate(date('Y', $mixed), date('n', $mixed), date('j', $mixed));
+			$arg->setTime(date('G', $mixed), date('i', $mixed), date('s', $mixed));
 		}
+		else
+		{
+			$arg = (int) $mixed;
+		}
+		$range[] = $from->format($format);
 
-		// Our loop only appended dates prior to our end date
-		$range[] = date($format, $unix_end);
+		if (is_int($arg)) // Day intervals
+		{
+			do
+			{
+				$from->modify('+1 day');
+				$range[] = $from->format($format);
+			}
+			while (--$arg > 0);
+		}
+		else // end date UNIX timestamp
+		{
+			for ($from->modify('+1 day'), $end_check = $arg->format('Ymd'); $from->format('Ymd') < $end_check; $from->modify('+1 day'))
+			{
+				$range[] = $from->format($format);
+			}
+
+			// Our loop only appended dates prior to our end date
+			$range[] = $arg->format($format);
+		}
 
 		return $range;
 	}
